<!--
 * @Description: file content
 * @Author: Zt2tzzt
 * @Date: 2021-09-17 11:13:03
 * @LastEditors: Zt2tzzt
 * @LastEditTime: 2021-09-17 11:28:32
 * @LastEditContent: 
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>

  <template id="my-app">
    <!-- 完整写法 -->
    <button v-on:click="btn1Click">按钮1</button>
    <div class="area" v-on:mousemove="mouseMove">div</div>

    <!-- 语法糖 -->
    <button @click="btn1Click">按钮1</button>

    <!-- 绑定一个表达式:inline statement -->
    <button @click="counter++">{{counter}}</button>

    <!-- 绑定一个对象 -->
    <div class="area" v-on="{click: btn1Click, mousemove: mouseMove}">哈哈哈</div>
    <div class="area" @="{click: btn1Click, mousemove: mouseMove}">哈哈哈</div>
  </template>

  <script src="https://unpkg.com/vue@next"></script>
  <script>
    const app = {
      template: '#my-app',
      data() {
        return {
          counter: 100
        }
      },
      methods:{
        btn1Click () {
          console.log('按钮1发生了点击');
        },
        mouseMove () {
          console.log('鼠标移到')
        }
      }
    }
    Vue.createApp(app).mount('#app')
  </script>
</body>
</html>